package hk.linkcredit.walletservice.wallet.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import hk.linkcredit.walletservice.wallet.domain.entity.SysDictData;
import hk.linkcredit.walletservice.wallet.mapper.SysDictDataMapper;
import hk.linkcredit.walletservice.wallet.mapper.SysDictTypeMapper;
import hk.linkcredit.walletservice.wallet.service.SysDictDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 字典数据表 服务实现类
 * </p>
 *
 * @author LinkCredit
 * @since 2022-06-11 12:32:47
 */
@Service
public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDictData> implements SysDictDataService {

    @Autowired
    private SysDictDataMapper dictDataMapper;

    @Autowired
    private SysDictTypeMapper dictTypeMapper;

    /**
     * 根据条件分页查询字典数据
     *
     * @param dictData 字典数据信息
     * @return 字典数据集合信息
     */
    @Override
    public List<SysDictData> selectDictDataList(SysDictData dictData) {
        return dictDataMapper.selectDictDataList(dictData);
    }

    @Override
    public List<SysDictData> selectDataDictDataList(SysDictData dictData) {
        return dictDataMapper.selectDataDictDataList(dictData);
    }

    /**
     * 根据字典类型和字典键值查询字典数据信息
     *
     * @param dictType  字典类型
     * @param dictValue 字典键值
     * @return 字典标签
     */
    @Override
    public String selectDictLabel(String dictType, String dictValue) {
        return dictDataMapper.selectDictLabel(dictType, dictValue);
    }

    @Override
    public List<String> selectDictLabel(String dictType, String[] dictValue) {
        return dictDataMapper.selectDictLabels(dictType, dictValue);
    }

    @Override
    public List<SysDictData> selectDictLabelByType(String dictType) {
        return dictDataMapper.selectDictLabelByType(dictType);
    }

    /**
     * 根据字典数据ID查询信息
     *
     * @param dictCode 字典数据ID
     * @return 字典数据
     */
    @Override
    public SysDictData selectDictDataById(Long dictCode) {
        return dictDataMapper.selectDictDataById(dictCode);
    }

}
